﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using snat.algorithms.network.TFIDF;
using snat.algorithms.node;
using snat.model;
using snat.proxy.items;

namespace algorithms.Factories {
    public class RandomNodeFactory : INodeFactory {

        private double probability;
        Random rand;

        public RandomNodeFactory(double probability) {
            this.probability = probability;
            this.rand = new Random();
        }

        int nodecount = 0;
        public BaseNode Instantiate(DBEntity e) {
            if (rand.NextDouble() < probability) {
                return new ClusterNode(nodecount++, e.EntityName, rand.Next(10));
            }
            return null;
        }
    }
}
